<template>
  <div class="verify">

    <slide-verify :l="42"
                  :r="10"
                  :w="310"
                  :h="155"
                  @success="onSuccess"
                  @fail="onFail"
                  @refresh="onRefresh"
                  :slider-text="text"
    ></slide-verify>
    <div>{{msg}}</div>
  </div>

</template>

<script>
export default {
  name: 'verify',
  data () {
    return {
      msg: '',
      text: '向右滑动'
    }
  },
  props: [
    'loginform',
    'getUrl',
    'successUrl'
  ],
  methods: {
    onSuccess (data) {
      this.$axios.post(this.getUrl, this.loginform).then(res => {
        if (res.data === 1) {
          this.$router.push(this.successUrl)
        } else {
          this.$message('账号或密码错误')
        }
      })
    },
    onFail () {
      this.msg = ''
    },
    onRefresh () {
      this.msg = ''
    }
  }
}
</script>

<style scoped>
  .verify {

  }
</style>
